//
//  MSShowerInfoView.m
//  MS
//
//  Created by Yuan on 13-3-23.
//  Copyright (c) 2013年 He Yuan. All rights reserved.
//

#import "MSShowerInfoView.h"
#import "UIButton+WebCache.h"

@implementation MSShowerInfoView
@synthesize avatarButton;
@synthesize desText;

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        UIImage *tipImage = [UIImage imageNamed:@"pro_mask"];
        UIImageView *tipImageView = [[UIImageView alloc]initWithFrame:CGRectMake(frame.size.width/2 - tipImage.size.width/4,0, tipImage.size.width/2, tipImage.size.height/2)];
        [tipImageView setImage:tipImage];
        [self addSubview:tipImageView];
        
        avatarButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        [avatarButton setFrame:CGRectMake(20,22, 50, 50)];
        avatarButton.layer.cornerRadius = 8.0f;
        avatarButton.layer.masksToBounds = YES;
        [self addSubview:avatarButton];
        
        desText = [[UITextView alloc]initWithFrame:CGRectMake(70, 21, 240,55)];
        desText.editable = NO;
        desText.contentInset = UIEdgeInsetsMake(-8, 0, -8, 0);
        desText.backgroundColor = [UIColor clearColor];
        desText.textColor = [UIColor whiteColor];
        [desText setText:HYLocalizedString(@"往往往往往往往往往往往往往往往往往往往往往往往往往往往往往往往往往往往往往往往往往往往往为我")];
        [self addSubview:desText];
        
    }
    return self;
}


-(void)loadAvatarImage:(NSString *)url
{
    if (url && [url length]>0)
    {
        [avatarButton setImageWithURL:[NSURL URLWithString:url] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"default_img"]];
    }
    else
        [avatarButton setImage:[UIImage imageNamed:@"default_img"] forState:UIControlStateNormal];
}

-(void)refreshDescription:(NSString *)des
{
    desText.text = des;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

@end
